package com.mycompany.myapp.service.impl;

import com.mycompany.myapp.service.YongService;
import com.mycompany.myapp.domain.Yong;
import com.mycompany.myapp.repository.YongRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Service Implementation for managing Yong.
 */
@Service
@Transactional
public class YongServiceImpl implements YongService {

    private final Logger log = LoggerFactory.getLogger(YongServiceImpl.class);

    private final YongRepository yongRepository;

    public YongServiceImpl(YongRepository yongRepository) {
        this.yongRepository = yongRepository;
    }

    /**
     * Save a yong.
     *
     * @param yong the entity to save
     * @return the persisted entity
     */
    @Override
    public Yong save(Yong yong) {
        log.debug("Request to save Yong : {}", yong);
        return yongRepository.save(yong);
    }

    /**
     * Get all the yongs.
     *
     * @param pageable the pagination information
     * @return the list of entities
     */
    @Override
    @Transactional(readOnly = true)
    public Page<Yong> findAll(Pageable pageable) {
        log.debug("Request to get all Yongs");
        return yongRepository.findAll(pageable);
    }

    /**
     * Get one yong by id.
     *
     * @param id the id of the entity
     * @return the entity
     */
    @Override
    @Transactional(readOnly = true)
    public Yong findOne(Long id) {
        log.debug("Request to get Yong : {}", id);
        return yongRepository.findOne(id);
    }

    /**
     * Delete the yong by id.
     *
     * @param id the id of the entity
     */
    @Override
    public void delete(Long id) {
        log.debug("Request to delete Yong : {}", id);
        yongRepository.delete(id);
    }
}
